/**
 * 模拟数据挂载
 */
let subscribe = () => {};

window.JeeWeb = {
    deviceBind: [
        {
            devices: [
                {
                    id: '-2010010001000000001',
                    code: '010010001',
                    name: '客厅灯',
                    type: 1,
                    avatar: 'https://cn.rollupjs.org/rollup-logo.svg',
                    remark: '客厅大灯',
                    thirdParty: false,
                },
            ],
            type: 'Single',
        },
        {
            conditionData: 'and',
            devices: [
                {
                    id: '-2010010002000000001',
                    code: '010010002',
                    name: '插座1',
                    type: 1,
                    avatar: 'https://cn.rollupjs.org/rollup-logo.svg',
                    remark: '',
                    thirdParty: false,
                },
                {
                    id: '-2010010002000000002',
                    code: '010010002',
                    name: '插座2',
                    type: 1,
                    avatar: 'https://cn.rollupjs.org/rollup-logo.svg',
                    remark: '',
                    thirdParty: false,
                },
                {
                    id: '-2010010002000000003',
                    code: '010010002',
                    name: '插座3',
                    type: 1,
                    avatar: 'https://cn.rollupjs.org/rollup-logo.svg',
                    remark: '',
                    thirdParty: false,
                },
            ],
            type: 'Group',
        },
    ],
    command: (payload) => {
        console.log('command :>> ', payload);

        const 延迟 = false;

        setTimeout(
            () => {
                payload.callback({
                    code: 200,
                    data: true,
                });
            },
            延迟 ? (Math.floor(Math.random() * (12 - 8 + 1)) + 8) * 1000 : 0,
        );
    },
    subscribe: (callback) => {
        subscribe = callback;
    },
};

const DeviceManager = new DeviceManagerSDK();
